package lab02.test33;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;


public class Test33 {
    public static void main(String[] args) {
        System.out.println("请输入单词：");
        List<String> words = new ArrayList<String>();
        Scanner scanner = new Scanner(System.in);
        String a = scanner.nextLine();
        String[] A = a.split("");
        for(int i=0;i<A.length;i++){
            words.add(A[i]);
        }
        System.out.println("排序前：");
        for (String n:words){
            System.out.print("位置："+words.indexOf(n)+":");
            System.out.println(n);
        }
        System.out.println("排序后：");
        Collections.sort(words);
        for (String n:words){
            System.out.print("位置："+words.indexOf(n)+":");
            System.out.println(n);
        }

    }
}
